<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>发票管理系统 - 首页</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        body {
            background-color: #f8f9fa;
        }

        .sidebar {
            height: 100vh;
            background-color: #343a40;
            color: white;
            position: fixed;
            width: 250px;
            padding-top: 20px;
        }

            .sidebar .nav-link {
                color: rgba(255, 255, 255, 0.8);
                margin-bottom: 5px;
                border-radius: 5px;
                padding: 10px 15px;
            }

                .sidebar .nav-link:hover {
                    background-color: #495057;
                    color: white;
                }

                .sidebar .nav-link.active {
                    background-color: #007bff;
                    color: white;
                }

        .main-content {
            margin-left: 250px;
            padding: 20px;
        }

        .welcome-card {
            border-radius: 10px;
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
        }

        .quick-action-card {
            transition: transform 0.3s;
            cursor: pointer;
        }

            .quick-action-card:hover {
                transform: translateY(-5px);
            }
    </style>
</head>
<body>
    <div class="sidebar">
        <div class="text-center mb-4">
            <h4>发票管理系统</h4>
        </div>
        <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link active" href="welcome.html">
                    <i class="bi bi-house-door me-2"></i>首页
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="upload.html">
                    <i class="bi bi-upload me-2"></i>发票上传
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="query.html">
                    <i class="bi bi-search me-2"></i>发票查询
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="statistic.html">
                    <i class="bi bi-bar-chart me-2"></i>发票统计
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#" id="logoutBtn">
                    <i class="bi bi-box-arrow-right me-2"></i>退出登录
                </a>
            </li>
        </ul>
    </div>

    <div class="main-content">
        <div class="container-fluid">
            <div class="row mb-4">
                <div class="col">
                    <h2>欢迎使用发票管理系统</h2>
                    <p class="text-muted" id="welcomeMessage">欢迎回来</p>
                </div>
            </div>

            <div class="row mb-4">
                <div class="col-md-8">
                    <div class="card welcome-card">
                        <div class="card-body">
                            <h5 class="card-title">系统公告</h5>
                            <p class="card-text">
                                欢迎使用发票管理系统，本系统可以帮助您高效管理发票信息。<br>
                                主要功能包括：发票上传、发票识别、发票查询和统计分析。
                            </p>
                            <div class="alert alert-info">
                                <i class="bi bi-info-circle"></i> 提示：上传发票时请确保图片清晰，以提高识别准确率。
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="card welcome-card">
                        <div class="card-body">
                            <h5 class="card-title">快捷操作</h5>
                            <div class="d-grid gap-2">
                                <button class="btn btn-primary" onclick="window.location.href='upload.html'">
                                    <i class="bi bi-upload me-2"></i>上传发票
                                </button>
                                <button class="btn btn-success" onclick="window.location.href='query.html'">
                                    <i class="bi bi-search me-2"></i>查询发票
                                </button>
                                <button class="btn btn-info" onclick="window.location.href='statistic.html'">
                                    <i class="bi bi-bar-chart me-2"></i>查看统计
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-4 mb-3">
                    <div class="card quick-action-card h-100" onclick="window.location.href='upload.html'">
                        <div class="card-body text-center">
                            <i class="bi bi-upload" style="font-size: 2rem; color: #0d6efd;"></i>
                            <h5 class="card-title mt-3">上传发票</h5>
                            <p class="card-text text-muted">上传图片格式的发票文件</p>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 mb-3">
                    <div class="card quick-action-card h-100" onclick="window.location.href='query.html'">
                        <div class="card-body text-center">
                            <i class="bi bi-search" style="font-size: 2rem; color: #198754;"></i>
                            <h5 class="card-title mt-3">发票查询</h5>
                            <p class="card-text text-muted">按日期或关键字查询发票</p>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 mb-3">
                    <div class="card quick-action-card h-100" onclick="window.location.href='statistic.html'">
                        <div class="card-body text-center">
                            <i class="bi bi-bar-chart" style="font-size: 2rem; color: #0dcaf0;"></i>
                            <h5 class="card-title mt-3">发票统计</h5>
                            <p class="card-text text-muted">查看发票统计数据和图表</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 检查用户是否已登录
        const user_id = localStorage.getItem('user_id');
        if (!user_id) {
            window.location.href = 'index.html';
        }

        document.getElementById('logoutBtn').addEventListener('click', function () {
            localStorage.removeItem('user_id');
            window.location.href = 'index.html';
        });
    </script>
</body>
</html>